#include "chess_man.h"

#include "chess_board.h"



void ChessMan::SetXy(const PointU& xy)
{
	_xy = xy;
	
	Position pos = ChessBoard::Xy2Pos(toPoint(xy));
	if (_sprBg)
	{
		Position size = toPosition(g_factory->GetSpriteTexSize(_sprBg));
		Position anchor = toPosition(g_factory->GetSpriteAnchor(_sprBg));
		float k = 棋子宽度 / size[1];
		size *= k;
		anchor *= k;
		_sprBg->SetQuad(createQuad(size, false) + pos - anchor);
	}
	_txt->SetPositionAlign(pos, Align::CC);

}
